<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改出差申请单')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ccsq-edit" th:object="${gcCcsq}">
            <input name="id" th:field="*{id}" type="hidden">
            <input name="orderNo" th:field="*{orderNo}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">类型：</label>
                <div class="col-sm-8">
                     <select name="type" th:field="*{type}" class="form-control" required>
	                    <option value="差旅 ">差旅</option>
	                    <option value="事假 ">事假</option>
	                    <option value="病假 ">病假</option>
	                </select>
                </div>
            </div>
        	<div class="form-group">    
                <label class="col-sm-3 control-label is-required">起点：</label>
                <div class="col-sm-8">
                     <input name="statsAdd" th:field="*{statsAdd}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="statsAt" autoComplete="off" required th:value="${#dates.format(gcCcsq.statsAt, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">终点：</label>
                <div class="col-sm-8">
                     <input name="endAdd" th:field="*{endAdd}" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="endAt" autoComplete="off" required th:value="${#dates.format(gcCcsq.endAt, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">事由：</label>
                <div class="col-sm-8">
                    <textarea name="descs" autoComplete="off" required class="form-control">[[*{descs}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" th:if="${gcCcsq.status} eq 0" class="btn btn-sm btn-primary" onclick="saveHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" th:if="${gcCcsq.status} eq 0" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>提 交</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/ccsq";
        $("#form-ccsq-edit").validate({
            focusCleanup: true
        });

        function saveHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/edit", $('#form-ccsq-edit').serialize());
            }
        }
        
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/editSubmit", $('#form-ccsq-edit').serialize());
            }
        }

        $("input[name='statsAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='endAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    </script>
</body>
</html>